package com.ycf.controler;


import com.ycf.serevice.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {

    @Autowired
    private UserService userService;

    /**
     * restfull风格写法
     * @param id
     * @return
     */
    @RequestMapping("/getUser/{id}")
    public String getUserById(@PathVariable int id ) {

        return userService.getUserById(id).toString();
    }

    @RequestMapping("/userList")
    public String getUserList() {

        return userService.getUserList().toString();
    }


}
